//
//  Extension.swift
//  颖姐姐
//
//  Created by wu on 2017/7/4.
//  Copyright © 2017年 wu. All rights reserved.
//

import UIKit
import Kingfisher

extension UILabel{

    ///
    ///
    /// - Parameters:
    ///   - text: <#text description#>
    ///   - textColor: <#textColor description#>
    ///   - fontSize: <#fontSize description#>
    ///   - numberlines: <#numberlines description#>
    /// - Returns: <#return value description#>
    class func create(text:String?,textColor:UIColor = .lightGray,fontSize:CGFloat = 12,numberlines:Int = 1) -> UILabel{
        
        let lable = UILabel()
        lable.text = text
        lable.font = UIFont.systemFont(ofSize: fontSize)
        
        lable.sizeToFit()
    
        return lable
    }
}

extension UIButton{
    
}

extension UIImageView{

    func y_setImage(urlString:String?,placeholder:UIImage){
        
        guard let url = urlString  else {
            image = placeholder
            return
        }
        let resource = URL(string: url)
        
        kf.setImage(with: resource, placeholder: placeholder, options: [], progressBlock: nil) {[weak self] (image, _, _, _) in
            self?.image = image
        }
    
    }
}



